<%@ include file="/WEB-INF/jspf/constant.jspf" %>
<%@ page language="java" import="java.util.*" %>

<!--Form Function-->
<script type="text/javascript" >
    // pre-submit callback
    function showRequest(formData, jqForm, options) {
        var queryString = $.param(formData);
        //        alert('About to submit: \n\n' + queryString);
        return true;
    }

    // post-submit callback
    function showResponse(responseText, statusText, xhr, $form)  {
        BindJsonToHtml(responseText);

        //        $("#formCureplan #ButtonCommand_wrapper").find("input, button").uniform();
        $.uniform.update("#formCureplanDoctor input, #formCureplanDoctor textarea, #formCureplanDoctor select,#formCureplanDoctor button");
        BalanceFormHeight();
        //        alert("success");
    }
    // Reset Form Height
    function BalanceFormHeight()  {
        ResetFormHeight("#wrapSymptom", "#wrapSymptomComment");
        ResetFormHeight("#wrapAllergicHistory", "#wrapAllergicHistoryComment");
        ResetFormHeight("#wrapDiseaseHistory", "#wrapDiseaseHistoryComment");
        ResetFormHeight("#wrapAttachHistory", "#wrapAttachHistoryComment");
        ResetFormHeight("#wrapRoomType", "#wrapRoomTypeComment");
        ResetFormHeight("#wrapPriceMinAccept", "#wrapPriceMinAcceptComment");
        ResetFormHeight("#wrapDateMinAccept", "#wrapDateMinAcceptComment");
        ResetFormHeight("#wrapRequestQuotation", "#wrapAttachQuotation");
        ResetFormHeight("#wrapHotel", "#wrapHotelComment");
        ResetFormHeight("#wrapSpecialist", "#wrapSpecialistComment");
    }
    function ResetFormHeight(idPlan, idPlanDoctor)  {
        if($(idPlan).height() >  $(idPlanDoctor).height()) {$(idPlanDoctor).height($(idPlan).height());}
        else  {$(idPlan).height($(idPlanDoctor).height());}

    }
    //    var options = {
    //        url: '<%=request.getContextPath()%>/SRV/CurePlanProviderDetail/formCureplanDoctor_Submit',
    //        type: 'GET',
    //        dataType:  'json',
    //        beforeSubmit:  showRequest,  // pre-submit callback
    //        success:       showResponse  // post-submit callback
    //    };

    (function($) {
        $.fn.getDataDDL = function(strCodebehide,strDefault){
            var $this = $(this);
            $.ajax({
                type: 'POST',
                url: '<%=request.getContextPath()%>'+strCodebehide ,
                dataType: 'json',
                async: false,
                success: function(data){
                    populateSelect($this.get(0), data, strDefault);
                    $.uniform.update($this);
                },
                error: function(){
                    alert("Error in json");
                }
            });
        };
    })(jQuery);


    $(document).ready(function() {
        /**
         * LoadData
         */
    <%ResourceBundle resource = ResourceBundle.getBundle("Constant_en");%>
                var strSelectDefault = "<%= resource.getString("project.select.default")%>";
                $("#ddlSpecialistComment").getDataDDL('/Share/getSpecialist',strSelectDefault);
                $("#ddlHotelComment").getDataDDL('/Share/getHotel',strSelectDefault);
        
                $.ajax({
                    url: "SRV/CurePlanProviderDetail/getJson" ,
                    type: "POST",
                    async: false, // temporarily lock the browser, disabling any actions while the request is active
                    data: {
                        curePlanDoctorId: $("#curePlanDoctorId").val()
                    },
                    dataType: "json",
                    success: function(data){

                        $("#formCureplanDoctor").find("input, select, button, textarea").uniform({selectClass: 'selector full_width width-100'});
                        $("#datDateMinAcceptComment").datepicker();
                        $("#datDateMaxAcceptComment").datepicker();
                        $("#btnReset").click(function(){
                            $("#formCureplanDoctor").get(0).reset();
                            $.uniform.update("#formCureplanDoctor input, #formCureplanDoctor textarea, #formCureplanDoctor select,#formCureplanDoctor button");
                            return false
                        });
                        //!Must Bind after uniform process because control can't find
                        BindJsonToHtml(data);
                        $.uniform.update("#formCureplanDoctor input, #formCureplanDoctor textarea, #formCureplanDoctor select,#formCureplanDoctor button");

                        //Balance Form Height
                        BalanceFormHeight();

                        //Bind form submit
                        $("#formCureplanDoctor").ajaxSubmit({
                            url: '<%=request.getContextPath()%>/SRV/CurePlanProviderDetail/formCureplanDoctor_Submit?'+$(form).serialize(),
                            type: 'POST',
                            dataType:  'json',
                            beforeSubmit:  showRequest,  // pre-submit callback
                            success:       showResponse  // post-submit callback
                        });
                        
                        $("#txtPriceMinAcceptComment").blur(function() {
                            $("#txtPriceMaxAcceptComment").valid();
                            $("#txtPriceMinAcceptComment").valid();
                        });
                    }
                });
                /**
                 * End LoadData
                 */

                /**
                 * Bind Event
                 */
                $("#btnBack").click(function() {
                    ContentAjaxRequest('SRV/CurePlanProviderList', 'section #container');
                });

                $("#btnManagePlan").click(function() {
                    ContentAjaxRequest('SRV/CurePlanProviderList', 'section #container');
                });
                /**
                 * End Bind Event
                 */
            });
</script>
<!--End Form Function-->
<!--insert content here-->
<h3>Cure Plan Provider Detail</h3>
<div id="message">

</div>
<div class="grid_9">
    <div class="box1">
        <div class="indent-box1">
            <div class="wrapper">
                <form id="formCureplan" class="form" >
                    <table>
                        <tr>
                            <td colspan="2">
                                <h4>
                                    Patient Symptom
                                </h4>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Symptom
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapSymptom" >
                                    <label id="lblSymptom">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Allergic History
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapAllergicHistory">
                                    <label id="lblAllergicHistory">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Disease History
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapDiseaseHistory">
                                    <label id="lblDiseaseHistory">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Attach History
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapAttachHistory">
                                    <label id="lblAttachHistory">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1">
                                    <!--                                Space For new Comment-->
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <h4>
                                    Your Request
                                </h4>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Room Type
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapRoomType">
                                    <label id="lblRoomType">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <em>
                                    Price Accept Min
                                </em>
                            </td>
                            <td>
                                <em>
                                    Price Accept Max
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td width="50%">
                                <div class="p1" id="wrapPriceMinAccept">
                                    <label id="lblPriceMinAccept">
                                    </label>
                                </div>
                            </td>
                            <td width="50%">
                                <div class="p1" id="txtPriceMaxAccept_wrapper">
                                    <label id="lblPriceMaxAccept">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <em>
                                    Date Accept Start
                                </em>
                            </td>
                            <td>
                                <em>
                                    Date Accept End
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td width="50%">
                                <div class="p1" id="wrapDateMinAccept">
                                    <label id="lblDateMinAccept">
                                    </label>
                                </div>
                            </td>
                            <td width="50%">
                                <div class="p1" id="datDateMaxAccept_wrapper">
                                    <label id="lblDateMaxAccept">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Request Quotation
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapRequestQuotation">
                                    <input type="checkbox" id="chkRequestQuotation" name="chkRequestQuotation" />
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Select Hotel
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapHotel">
                                    <label id="lblHotel">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Select Specialist
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapSpecialist">
                                    <label id="lblSpecialist">
                                    </label>
                                </div>

                            </td>
                        </tr>
                    </table>

                </form>
            </div>
        </div>
    </div>
</div>
<div class="grid_7">
    <div class="box">
        <div class="indent-box">
            <div class="wrapper">
                <form id="formCureplanDoctor" class="form" >
                    <table>
                        <tr>
                            <td colspan="2">
                                <h4>
                                    Medical analysis
                                </h4>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Symptom Comment
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapSymptomComment" >
                                    <textarea rows="5" cols="50" name="txtSymptomComment" id="txtSymptomComment" ></textarea>
                                    <label style="display:none;" id="lblSymptomComment">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Allergic History Comment
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapAllergicHistoryComment">
                                    <textarea rows="5" cols="50" name="txtAllergicHistoryComment" id="txtAllergicHistoryComment" ></textarea>
                                    <label style="display:none;" id="lblAllergicHistoryComment">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Disease History Comment
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapDiseaseHistoryComment">
                                    <textarea rows="5" cols="50" name="txtDiseaseHistoryComment" id="txtDiseaseHistoryComment" ></textarea>
                                    <label style="display:none;" id="lblDiseaseHistoryComment">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Attach History Comment
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapAttachHistoryComment">
                                    <textarea rows="5" cols="50" name="txtAttachHistoryComment" id="txtAttachHistoryComment" ></textarea>
                                    <label style="display:none;" id="lblAttachHistoryComment">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1">
                                    <!--                                Space For new header-->
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <h4>
                                    Request Comment
                                </h4>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Room Type Comment
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapRoomTypeComment">
                                    <textarea rows="5" cols="50" name="txtRoomTypeComment" id="txtRoomTypeComment" ></textarea>
                                    <label style="display:none;" id="lblRoomTypeComment">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <em>
                                    Price Estimate Min
                                </em>
                            </td>
                            <td>
                                <em>
                                    Price Estimate Max
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td width="50%">
                                <div class="p1" id="wrapPriceMinAcceptComment">
                                    <input type="text" id="txtPriceMinAcceptComment" name="txtPriceMinAcceptComment" class="width-90" />
                                    <label style="display:none;" id="lblPriceMinAcceptComment">
                                    </label>
                                </div>
                            </td>
                            <td width="50%">
                                <div class="p1" id="lblPriceMaxAcceptComment_wrapper">
                                    <input type="text" id="txtPriceMaxAcceptComment" name="txtPriceMaxAcceptComment" class="width-90" />
                                    <label style="display:none;" id="lblPriceMaxAcceptComment">
                                    </label>
                                    <label id="errorLabel" style="display:none;" class="error" >Max Price cannot be lower than Min Price</label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <em>
                                    Date Accept Start
                                </em>
                            </td>
                            <td>
                                <em>
                                    Date Accept End
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td width="50%">
                                <div class="p1" id="wrapDateMinAcceptComment">
                                    <input type="text" id="datDateMinAcceptComment" name="datDateMinAcceptComment" class="width-60"  />
                                    <label style="display:none;" id="lblDateMinAcceptComment">
                                    </label>
                                </div>
                            </td>
                            <td width="50%">
                                <div class="p1" id="lblDateMaxAcceptComment_wrapper">
                                    <input type="text" id="datDateMaxAcceptComment" name="datDateMaxAcceptComment" class="width-60"  />
                                    <label style="display:none;" id="lblDateMaxAcceptComment">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Attach Quotation
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapAttachQuotation">
                                    <div class="uploader" id="pnlAttachQuotation">
                                        <input class="file" type="file" id="uplAttachQuotation" name="uplAttachQuotation" style="opacity: 0;" >
                                        <span class="filename">No file selected</span>
                                        <span class="action">Choose File</span>
                                        <small>
                                            file type: .doc, .docx, .pdf | file size: 10 MB
                                        </small>
                                    </div>
                                    <label style="display:none;" id="lblAttachQuotation">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Suggest Hotel
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapHotelComment">
                                    <select id="ddlHotelComment" name="ddlHotelComment" class="width-100" >
                                    </select>
                                    <label style="display:none;" id="lblHotelComment">
                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <em>
                                    Suggest Specialist
                                </em>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="p1" id="wrapSpecialistComment">
                                    <select id="ddlSpecialistComment" name="ddlSpecialistComment" class="width-100" >

                                    </select>
                                    <label style="display:none;" id="lblSpecialistComment">

                                    </label>
                                </div>
                            </td>
                        </tr>
                        <tr >
                            <td colspan="2">
                                <div class="p1" id="ButtonCommand_wrapper">
                                    <button type="button" name="btnBack" id="btnBack" value="Back">
                                        <span>Back</span>
                                    </button>
                                    <button type="button" name="btnManagePlan" id="btnManagePlan" value="ManagePlan">
                                        <span>Manage Plan</span>
                                    </button>
                                    <input type="reset" name="btnReset" id="btnReset" value="Reset" />

                                    <button type="submit" name="btnReply" id="btnReply" value="Reply">
                                        <span>Reply</span>
                                    </button>
                                    <input type="submit" name="btnSubmit" id="btnSubmit" value="Accept Request" />
                                </div>
                            </td>
                        </tr>
                    </table>
                    <!-- Hidden Field-->
                    <div>
                        <input type="hidden" id="curePlanDoctorId" name="curePlanDoctorId" value="<%=  request.getAttribute("curePlanDoctorId")%>" />
                    </div>
                    <!-- End Hidden Field-->
                </form>
            </div>
        </div>
    </div>
</div>
